public class Team {
    private String name;
    private int matchesPlayed;
    private int wins;
    private int draws;
    private int losses;
    private int goalsScored;
    private int goalsConceded;
    private int points;

    public Team(String name) {
        this.name = name;
        this.matchesPlayed = 0;
        this.wins = 0;
        this.draws = 0;
        this.losses = 0;
        this.goalsScored = 0;
        this.goalsConceded = 0;
        this.points = 0;
    }

    public void updateMatch(int goalsFor, int goalsAgainst) {
        this.matchesPlayed++;
        this.goalsScored += goalsFor;
        this.goalsConceded += goalsAgainst;

        if (goalsFor > goalsAgainst) {
            this.wins++;
            this.points += 3;
        } else if (goalsFor == goalsAgainst) {
            this.draws++;
            this.points += 1;
        } else {
            this.losses++;
        }
    }

    public int getGoalDifference() {
        return this.goalsScored - this.goalsConceded;
    }

    public int getPoints() {
        return this.points;
    }

    public int getGoalsScored() {
        return this.goalsScored;
    }

    @Override
    public String toString() {
        return String.format("%-15s %2d %2d %2d %2d %3d %3d %3d %3d",
                name, matchesPlayed, wins, draws, losses, goalsScored, goalsConceded, points, getGoalDifference());
    }

    public String getName() {
        return name;
    }
}
